<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>园林管理系统</title>
    <%@include file="/common/head.jsp" %>
    <script type="text/javascript">
    	var setting = {
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				onClick: zTreeOnClick
			}
		};

    	function zTreeOnClick(event, treeId, treeNode) {
    	    $.ajax({
    	    	dataType:'json', 
    	    	url:'<%=ctx%>/organization/organization-suborg.action?pid='+treeNode.id,
    	    	success:function(data){
        	    	var content="";
        	    	if(data.length==0){
            	    	content+="<tr>";
            	    		content+="<td colspan='5' style='text-align:center;'>没有下级部门！</td>";
            	    	content+="</tr>";
        	    	}else{
        	    		$(data).each(function(index,item){
                	    	if(index%2==0){
                    	    	content+="<tr>";
                	    	}else{
                	    		content+="<tr class='alternate-row'>";
                	    	}
                	    	content+="<td>";
                	    		content+=item.code;
                	    	content+="</td>";
                	    	content+="<td>";
                	    		content+=item.name;
                	    	content+="</td>";
                	    	content+="<td>";
                	    		content+=typeof(item.linkMan)=="undefined"?"":item.linkMan;
                	    	content+="</td>";
                	    	content+="<td>";
                	    		content+=typeof(item.linkPhone)=="undefined"?"":item.linkPhone;
                	    	content+="</td>";
                	    	content+="<td class='options-width'>";
                	    		content+="<a href='' title='Edit' class='icon-1 info-tooltip'></a>";
                	    		content+="<a href='' title='Delete' class='icon-2 info-tooltip'></a>";
                	    	content+="</td>";
            	    	});	
        	    	}
        	    	
        	    	
        	    	$("#content-data").html(content);
				},
				error : function() {
				}
    	    });
    	};
		
		$(document).ready(function() {
			$.fn.zTree.init($("#organizationTree"), setting, ${organiztionTreeJson});
		});
    </script>
  </head>
  <body>
  	<!-- 提示框 -->
	<div id="message-green">
		<table border="0" width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td class="green-left">点击左侧部门树进行相关操作！ </td>
			<td class="green-right"><a class="close-green"><img src="<%=ctx%>/include/images/table/icon_close_green.gif"   alt="" /></a></td>
		</tr>
		</table>
	</div>
	
	<div id="left-content" style="float:left;width:30%;">
		<table border="0" width="100%" cellpadding="0" cellspacing="0" class="content-table">
			<tr>	
				<th class="topleft"></th>
				<td class="tbl-border-top">&nbsp;</td>
				<th class="topright"></th>	
			</tr>
			<tr>
				<td class="tbl-border-left"></td>
				<td>
					<!-- 页面主体 -->
					<div style="height:540px;">
						<ul id="organizationTree" class="ztree"></ul>
					</div>
				</td>
				<td class="tbl-border-right"></td>
			</tr>
			<tr>
				<th class="sized bottomleft"></th>
				<td class="tbl-border-bottom">&nbsp;</td>
				<th class="sized bottomright"></th>
			</tr>
		</table>
	</div>
	
	<div id="right-content" style="float:right;width:69%;">
		<table border="0" width="100%" cellpadding="0" cellspacing="0" class="content-table">
			<tr>	
				<th class="topleft"></th>
				<td class="tbl-border-top">&nbsp;</td>
				<th class="topright"></th>	
			</tr>
			<tr>
				<td class="tbl-border-left"></td>
				<td>
					<!-- 页面主体 -->
					<div style="height:540px;">
						<div class="control">
							<input type="submit" class="form-submit" value="新建" onclick="openArtDialog('<%=ctx%>/organization/organization-input.action','新增部门',420,270)"/>
						</div>
						
						<div>
							<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
								<tbody>
									<tr>
										<th class="table-header-id"><a href="javascript:void(0);" >部门编号</a>	</th>
										<th class="table-header-repeat line-left"><a href="javascript:void(0);">部门名称</a></th>
										<th class="table-header-repeat line-left"><a href="javascript:void(0);">联系人</a></th>
										<th class="table-header-repeat line-left"><a href="javascript:void(0);">联系电话</a></th>
										<th class="table-header-options line-left"><a href="javascript:void(0);">操作</a></th>
									</tr>
								</tbody>
								
								<tbody id="content-data">
									<!-- 先不显示全部部门
									<s:iterator value="organizationList" id="organization" status="status">
										<s:if test="#status.even">
										<tr class="alternate-row">
										</s:if>
										
										<s:else>
										<tr>
										</s:else>
										
										<td><s:property value="#organization.code"/></td>
										<td><s:property value="#organization.name"/></td>
										<td><s:property value="#organization.linkMan"/></td>
										<td><s:property value="#organization.linkPhone"/></td>
										<td>
											<a href='' title='Edit' class='icon-1 info-tooltip'></a>
											<a href='' title='Delete' class='icon-2 info-tooltip'></a>
										</td>
										</tr>
									</s:iterator>
									-->
								</tbody>
							</table>
						</div>
					</div>
				</td>
				<td class="tbl-border-right"></td>
			</tr>
			<tr>
				<th class="sized bottomleft"></th>
				<td class="tbl-border-bottom">&nbsp;</td>
				<th class="sized bottomright"></th>
			</tr>
		</table>
	</div>
  </body>
</html>
